package joke.deal;

import joke.ibatis.dao.RiddlesDao;
import joke.ibatis.dao.WeightDao;
import joke.ibatis.po.ParameterPo;
import joke.ibatis.po.RiddlesPo;
import joke.ibatis.po.WeightPo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;


public class ReRiddles {
	public RiddlesPo viewContent() {
		ApplicationContext factory = new ClassPathXmlApplicationContext(
				"applicationContext.xml");// 初始化配置文件
		RiddlesDao cdao = (RiddlesDao) factory.getBean("riddlesDao");// 获取pageLinkDao对象
		RiddlesPo po = cdao.getRiddlesPo("1");
		WeightDao wdao = (WeightDao) factory.getBean("weightDao");// 获取pageLinkDao对象
		WeightPo wpo = wdao.getWeightPo("riddles");
		po.setWpo(wpo);
		return po;

	}

	public RiddlesPo viewRiddlesByOrder(ParameterPo parpo) {
		ApplicationContext factory = new ClassPathXmlApplicationContext(
				"applicationContext.xml");// 初始化配置文件
		RiddlesDao cdao = (RiddlesDao) factory.getBean("riddlesDao");// 获取pageLinkDao对象
		RiddlesPo po = cdao.getRiddlesPoOrder(parpo);
		return po;

	}
}
